home *** CD-ROM | disk | FTP | other *** search
/ Visual FX for Image FX / VisualFX for Image FX 3.adf / Files / SetUp / 03 / 11.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1997-08-25  |  8.7 KB  |  363 lines

  1. /*
  2.                                  Visual FX
  3.                                     For
  4.                                  Image FX
  5.                                SetUp Script
  6.                            Written By J.L. White
  7.  
  8.                          (C)1997 Merlin's Software
  9.  
  10. */
  11. Quote = '22'X
  12. parse arg Num Frames
  13. options results
  14. address "IMAGEFX.1"
  15.     ReDraw On
  16.     RequestResponse "Do You Need Instructions?"
  17.     if rc = 0 then do
  18.         call Docs()
  19.         end    
  20.  
  21. if exists("libs:flyer.library") then do
  22.     if (POS('PROJECT_REXX_PORT',SHOW('Ports')) =0) then do
  23.         RequestNotify 'Flyer Must Be Running First!'
  24.         exit
  25.         end
  26.     call OpenFlyStuff()
  27.  
  28.  
  29.     Gadget.1 = 'D/110/22/120/ImageA Type/4/FLYER CLIP/FLYER STILL/FRAME/SEQUENCE'
  30.     ComplexRequest  '"Visual FX  SetUp Options"' 1 Gadget 250 60
  31.     if rc ~= 0 then do
  32.         call CloseStuff()
  33.         exit 0
  34.         end
  35.     else do
  36.         IAType = RESULT.1
  37.            end
  38.  
  39.     call GetA()
  40. end
  41. else do
  42.     Gadget.1 = 'D/110/22/120/ImageA Type/2/FRAME/SEQUENCE'
  43.     ComplexRequest  '"Visual FX  SetUp Options"' 1 Gadget 250 60
  44.     if rc ~= 0 then do
  45.         call CloseStuff()
  46.         exit 0
  47.         end
  48.     else do
  49.         IAType = RESULT.1+2
  50.            end
  51.  
  52.     call GetA()
  53. end
  54.     KillBrush
  55.     i = Start
  56.     call LoadA()
  57.     GetMain
  58.     parse var result Name Width Height Blah
  59.  
  60.     RequestNumber '"Enter Number Of Flares To Process!"' 1
  61.     FlareNum = result
  62.  
  63.     do FNum = 1 to FlareNum
  64.         Title = Quote"Enter Size Of Lens Flare #"FNum""Quote
  65.         RequestSlider Title 1 200 50
  66.         Answer2.FNum = Result
  67.  
  68.         Gadget.1 = ' Select Path Options For #'FNum
  69.         Gadget.2 = ' Draw Straight Line '
  70.         Gadget.3 = ' Draw Free Hand Line '
  71.         ListRequest 3 Gadget
  72.         PathType.FNum = 0
  73.         if result = 2 then PathType.FNum = 0
  74.         if result = 3 then PathType.FNum = 1
  75.         if PathType.FNum = 0 then call PickLine()
  76.         if PathType.FNum = 1 then call PickFreeLine()
  77.  
  78.  
  79.         Gadget.1 = ' Select Lens Flare Options For #'FNum
  80.         Gadget.2 = ' Use Default Lens Flare '
  81.         Gadget.3 = ' User Defined Lens Flare '
  82.         Gadget.4 = ' User Defined Radial Star '
  83.         ListRequest 4 Gadget
  84.         LensType.FNum = 0
  85.         if result = 2 then LensType.FNum = "Hook LensFlare Standard 0 50 255 252 82 225 25 0 255 255"
  86.         if result = 3 then do
  87.             Learn "RAM:LensType" NoHeader Quiet Force
  88.             Hook LensFlare
  89.             Learn Stop Quiet Force
  90.             call open TempFile,"Ram:LensType.ifx",R
  91.             line = readln(TempFile)
  92.             line = readln(TempFile)
  93.             line = readln(TempFile)
  94.             line = readln(TempFile)
  95.             line = readln(TempFile)
  96.             line = readln(TempFile)
  97.             LensType.FNum = readln(TempFile)
  98.             call close TempFile
  99.             end
  100.         if result = 4 then do
  101.             Learn "RAM:LensType" NoHeader Quiet Force
  102.             Hook RadialStar
  103.             Learn Stop Quiet Force
  104.             call open TempFile,"Ram:LensType.ifx",R
  105.             line = readln(TempFile)
  106.             line = readln(TempFile)
  107.             line = readln(TempFile)
  108.             line = readln(TempFile)
  109.             line = readln(TempFile)
  110.             line = readln(TempFile)
  111.             LensType.FNum = readln(TempFile)
  112.             call close TempFile
  113.             end
  114.         end
  115. if FlyOn = 1 then
  116.     call CloseStuff()
  117.  
  118. call open TempFile,"VFXIFX:TempDrawer/"strip(Num),W
  119. call writeln TempFile,PicAName
  120. call writeln TempFile,Start
  121. call writeln TempFile,End
  122. call writeln TempFile,IAType
  123. call writeln TempFile,FlareNum
  124. do FNum = 1 to FlareNum
  125.     call writeln TempFile,Answer.FNum
  126.     call writeln TempFile,Answer2.FNum
  127.     call writeln TempFile,PathType.FNum
  128.     call writeln TempFile,LensType.FNum
  129.     end
  130. call close TempFile
  131. exit
  132.  
  133. GetFile:
  134.     parse Arg Title, Path
  135.     Address FLY_1 SetString Path
  136.     Address FLY_1 GetFileNameNT Title
  137. return result
  138.  
  139. GetFileName: procedure  
  140.    ARG CompleteName
  141.    c = lastpos("/",CompleteName)
  142.    if c = 0 then c = lastpos(":",CompleteName)
  143.    return substr(CompleteName, c + 1)
  144.  
  145.  
  146. GetA:
  147.  if IAType = 0 then do
  148.     call Switcher(TOSW)
  149.     PicAName = GetFile("Select Flyer Clip For ImageA!  ",DriveName)
  150.     Name = GetFileName(PicAName)
  151.     if Name = "" then do
  152.         Address FLY_1 OK_TEXT " OK "
  153.         Title = "You Must Enter A Valid Clip Name To Use!"
  154.         Address FLY_1 FYINT Title
  155.         Address FLY_1 Quit
  156.         call Switcher(TOWB)
  157.         exit
  158.         end
  159.     Address FLY_1 SetFileName PicAName
  160.     Address FLY_1 GetClipLength PicAName
  161.     End = result
  162.     Start = 0
  163.     Address FLY_1 Program "5"
  164.     Address FLY_1 StartNum Start
  165.     Address FLY_1 EndNum End
  166.     Address FLY_1 CurrentNum "0"
  167.     Address FLY_1 GetTimeNT "Select A Range Of Frames To Process!"
  168.     Start = word(result,1)*2
  169.     End = word(result,2)*2
  170.     Start  = Start + 1
  171.     End = End +2
  172.     call addlib('PROJECT_REXX_PORT' , 0)
  173.     call addlib(TOASTERLIB,0)
  174.     call Switcher(TOWB)
  175.     address command "C:Wait 1"
  176.     ScreenToFront
  177.     end
  178.    if IAType = 1 then do
  179.     RequestFile '"Select Flyer Still For ImageA!"' DriveName ' '
  180.     PicAName = result
  181.     Name = GetFileName(PicAName)
  182.     if Name = "" then do
  183.         Title = "You Must Enter A Valid Name To Use!"
  184.         RequestNotify Title
  185.         if FlyOn = 1 then Address FLY_1 Quit
  186.         exit
  187.         end
  188.     RequestNumber '"Enter Number Of Frames To Process!"' Frames
  189.     End = result
  190.     Start = 1
  191.     end
  192.    if IAType = 2 then do
  193.     RequestFile '"Select FileName For ImageA!"' 'SYS:' ' '
  194.     PicAName = result
  195.     Name = GetFileName(PicAName)
  196.     if Name = "" then do
  197.         Title = "You Must Enter A Valid Name To Use!"
  198.         RequestNotify Title
  199.         if FlyOn = 1 then Address FLY_1 Quit
  200.         exit
  201.         end
  202.     RequestNumber '"Enter Number Of Frames To Process!"' Frames
  203.     End = result
  204.     Start = 1
  205.     end
  206.    if IAType = 3 then do
  207.     RequestFile '"Select BaseName For ImageA! "' 'SYS:' ' '
  208.     PicAName = result
  209.     Name = GetFileName(PicAName)
  210.     if Name = "" then do
  211.         Title = "You Must Enter A Valid Name To Use!"
  212.         RequestNotify Title
  213.         if FlyOn = 1 then Address FLY_1 Quit
  214.         exit
  215.         end
  216.     RequestNumber '"Enter Number Of Frames To Process!"' Frames
  217.     End = result
  218.     Start = 1
  219.     end
  220. return
  221.  
  222. CloseStuff:
  223.     Address FLY_1 Quit
  224.     call remlib('ToasterARexx.port')
  225.     call remlib('PROJECT_REXX_PORT')
  226. return
  227.  
  228.  
  229. OpenFlyStuff:
  230.     FlyOn = 1
  231.     address command "run VFXIFX:FLY" 
  232.     do while (POS('FLY_1',SHOW('Ports')) = 0)
  233.         address command "wait 1"
  234.         end
  235.     TOASTERLIB="ToasterARexx.port"
  236.     call remlib('ToasterARexx.port')
  237.     call remlib('PROJECT_REXX_PORT')
  238.     call addlib('PROJECT_REXX_PORT' , 0)
  239.     call addlib(TOASTERLIB,0)
  240.     DriveName = FindDrive()
  241. return
  242.  
  243.  
  244. FindDrive:
  245.     address command "C:Info >RAM:DriveList"
  246.     call open TempFile,"RAM:DriveList",R
  247.     do until eof(TempFile)
  248.         line = readln(TempFile)
  249.         parse var line Drive" "Rest
  250.         if Drive = "FA0:" then 
  251.             FlyVolume = word(Rest,7)":"
  252.     end
  253.     call close TempFile
  254.     address command "Delete >NIL: RAM:DriveList"
  255. return FlyVolume
  256.  
  257.  
  258. PickLine:
  259.     KillBrush
  260.     Menu ToolBox
  261.     DrawTool "Line"
  262.     RequestNotify "Draw Line From Point A To Point B For Movement Of Lens Flare #"FNum
  263.     HidePanel
  264.     Undo On
  265.     WaitFor SELECTDOWN
  266.     parse var result X1 Y1
  267.     WaitFor SELECTUP
  268.     parse var result X2 Y2
  269.     Undo
  270.     ShowPanel
  271.     Undo Off
  272.     GetMain
  273.     parse var result Name Width Height Blah
  274.     if X1 < 10 then X1 = -50
  275.     if Y1 < 10 then Y1 = -10
  276.     if X2 > (Width-10) then X2 = Width+100
  277.     if Y2 > (Height-10) then Y2 = Width+10
  278.     X1 = strip(X1)
  279.     Y1 = strip(Y1)
  280.     X2 = strip(X2)
  281.     Y2 = strip(Y2)
  282.     Answer.FNum = X1" "Y1" "X2" "Y2
  283.     RequestResponse "Is The Line You Have Drawn Correct?"
  284.     if rc ~= 0 then call PickLine()
  285.  
  286. return
  287.  
  288. PickFreeLine:
  289.     KillBrush
  290.     Menu ToolBox
  291.     DrawTool "FreeDraw"
  292.     RequestNotify "Draw Line For Movement Of Lens Flare #"FNum
  293.     HidePanel
  294.     Undo On
  295.     WaitFor SELECTDOWN
  296.     Learn "RAM:FreeDraw" NoHeader Quiet Force
  297.     WaitFor SELECTUP
  298.     Learn Stop Quiet Force
  299.     Undo
  300.     ShowPanel
  301.     Undo Off
  302.     RequestResponse "Is The Line You Have Drawn Correct?"
  303.     if rc ~= 0 then call PickFreeLine()
  304.     CountNum = 0
  305.     call open TempFile,"Ram:FreeDraw.ifx",R
  306.     call open TempFile2,"VFXIFX:TempDrawer/DrawNum."left(Num,2,'')"."right(FNum,2,'0'),W
  307.     line = readln(TempFile)
  308.     line = readln(TempFile)
  309.     line = readln(TempFile)
  310.     line = readln(TempFile)
  311.     line = readln(TempFile)
  312.     line = readln(TempFile)
  313.     do until eof(TempFile)
  314.         DoIt = readln(TempFile)
  315.         if DoIt = "FreeDraw" then leave
  316.         parse var DoIt Name" "Nums
  317.         call writeln TempFile2,Nums
  318.         CountNum = CountNum + 1
  319.         end
  320.     call close TempFile
  321.     call close TempFile2
  322.     Answer.FNum = right(CountNum,3,'0')
  323.     address command "Delete >NIL: RAM:FreeDraw.ifx"
  324. return
  325.  
  326. LoadA:
  327.     if IAType = 0 then do
  328.         LoadBuffer PicAName Force i
  329.         end
  330.     if IAType = 1 then do
  331.         LoadBuffer PicAName Force 1
  332.         end
  333.     if IAType = 2 then do
  334.         LoadBuffer PicAName Force
  335.         end
  336.     if IAType = 3 then do
  337.         LoadBuffer PicAName""right(i,3,'0') Force
  338.         end
  339. return
  340.  
  341.  
  342. Docs:
  343.  
  344.     text1 = '"This effect will create a Lens Flare, then move it"'
  345.     text2 = '"across the top of the image from Point-A to Point-B."'
  346.     text3 = '"You can also define your own path to follow. It will"'
  347.     text4 = '"ask for the size and path of the Flare. Then you have"'
  348.     text5 = '"the option to select our default settings or bring up"'
  349.     text6 = '"the Lens Flare panel & customize it the way you like."'
  350.  
  351.     Gadget.1  = 'TEXT LE=10 TE=4 LB='text1' '
  352.     Gadget.2  = 'TEXT LE=10 TE=14 LB='text2' '
  353.     Gadget.3  = 'TEXT LE=10 TE=24 LB='text3' '
  354.     Gadget.4  = 'TEXT LE=10 TE=34 LB='text4' '
  355.     Gadget.5  = 'TEXT LE=10 TE=44 LB='text5' '
  356.     Gadget.6  = 'TEXT LE=10 TE=54 LB='text6' '
  357.     Gadget.7= 'END'
  358.     NewComplexRequest  '"Instructions For Effect #11"' Gadget 386 66
  359.  
  360. return
  361.  
  362.  
  363.